package com.forum.demo.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.forum.demo.model.ArticleReply;
import com.forum.demo.model.response.ArticleReplyResponse;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

import java.util.List;

@Mapper
public interface ArticleReplyMapper extends BaseMapper<ArticleReply> {

    @Select("select avatar_url,nickname,article_reply.id,article_id,post_user_id,content,\n" +
            "like_count,article_reply.state,article_reply.create_time,article_reply.update_time\n" +
            "from user_info,article_reply\n" +
            "where article_reply.post_user_id = user_info.id\n" +
            "and article_reply.delete_state = 0\n" +
            "and article_id = #{articleId}\n" +
            "order by article_reply.create_time desc\n" +
            "limit 0, 100")
    public List<ArticleReplyResponse> selectArticleReply(Long articleId);


}
